/*
 * Graph.h
 *
 *  Created on: 16/ott/2014
 *      Author: angelo
 */

#ifndef GRAPH_H_
#define GRAPH_H_

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <list>
#include <vector>
#include <map>

using namespace std;

class Graph {
public:
	Graph();
	Graph(int val);
	Graph(int minVal, int maxVal, int grado, int nNodes, double percZero);
	virtual ~Graph();

	void printOut(Graph *parent);
	void recursivePrintOut(void);

	int getBestSubGraph(int nMaxNode);

private:
	void checkNonZeroLeaf(Graph *parent);

	int getRandomWidth(int minVal, int maxVal, double percZero);

	void reactivateAllNodes(void);

	void findBestSubTree(list<Graph *> boundary, int nMaxNode, int &localSum, int &totSum);

public:
	//Node *nodo;
	static int nextId;
	int id;
	int width;
	list<Graph *> vicini;
	double sumwidth;

	bool active;

	// creo una lista circolare
	Graph *nextGraph;
	Graph *previousGraph;
};


#endif /* GRAPH_H_ */
